package com.breezelin.freshmarket.entities.req;

/**
 * Created by Breeze Lin
 * 6:24 2016/5/30
 * 1linyufeng1@gmail.com
 */

import com.breezelin.freshmarket.entities.JsonStruct;

import org.json.JSONException;
import org.json.JSONObject;

/**
 * 相关商品查询实体
 */
public class AboutReq implements JsonStruct {

	/*
	{
        "CommodityId": "69664ad1-6563-462b-b688-1058abdcce55",
        "CategoryId": "1e17a99d-ca4b-49be-908b-93c8faa20baf"
    }
	 */

	/**
	 * 产品id
	 */
	private String commodityId;
	/**
	 * 分类id
	 */
	private String categoryId;

	public AboutReq(String commodityId, String categoryId) {
		this.commodityId = commodityId;
		if (categoryId == null) {
			this.categoryId = "";
		} else {
			this.categoryId = categoryId;
		}
	}

	@Override
	public void fromJson(JSONObject jsonObject) {

	}

	@Override
	public JSONObject toJson() {
		JSONObject ret = new JSONObject();
		try {
			ret.put("CommodityId", commodityId);
			ret.put("CategoryId", categoryId);
		} catch (JSONException e) {
			e.printStackTrace();
		}
		return ret;
	}
}
